﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace NutriFast
{
    public partial class Survey : Form
    {
        //0 agregar......1=editar
        public int estado = 0;
        public int id = 0;
        public Survey()
        {
            InitializeComponent();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            // create a writer and open the file
           
            
                TextWriter tw = new System.IO.StreamWriter("../../Survey/"+(dbVic.spVicBuscarIDSiguientePaciente()+1)+".txt");

                TextWriter tweditar = new System.IO.StreamWriter("../../Survey/" + id + ".txt");
            
            // write a line of text to the file
            if(estado==0)
                tw.WriteLine(this.textBox1.Text);
            else
                tweditar.WriteLine(this.textBox1.Text);

            // close the stream
            tw.Close();
            tweditar.Close();
            this.Close();
        }

 
    }
}
